import request from '@/utils/request'

export default{
    // 花园列表 查询数据
  getFlowerList(searchModel){
    return request({
      url: '/garden/gardenList',
      method:'get',
      params:{
        pageNo:searchModel.pageNo,
        pageSize:searchModel.pageSize,
        name:searchModel.name
      }
    });
  },
  getFlowerById(id){
    return request({
      url: `/garden/${id}`,
      method:'get',
    });
  },
  // 保存提交表单
  saveFlower(garden){
    if(garden.id == null && garden.id == undefined){
      return this.addFlower(garden);
    }
    return this.UpdateFlower(garden);
  },
//   添加
  addFlower(garden){
    return request({
      url: '/garden',
      method:'post',
     data:garden
    });
  },
  // 删除
  deltFlowerById(id){
    return request({
      url: `/garden/${id}`,
      method:'delete',
    });
  },

  // 修改
  UpdateFlower(garden){
    return request({
      url: '/garden',
      method:'put',
      data:garden
    });
  }
}
